#include "include.h"

_MB_LPF_T MB_LPF_IBus;

void MeBsp_LPF_Init(void)
{
  memset(&MB_LPF_IBus,0,sizeof(MB_LPF_IBus));
  MB_LPF_IBus.wK = 1638;
  
  USER_Debug_Out("--LPF Init\r\n");
}

uint16_t MeBsp_LPF_Get_Val(_MB_LPF_T *pLpf,uint16_t input_val)
{
  uint32_t val;
  val = pLpf->wK;
  val = ((val * input_val) + ( 32767 - pLpf->wK ) * pLpf->wLastVal);
  val = (val >> 15)&0x7FFF;
  pLpf->wLastVal = val;
  pLpf->wNewVal = val;
  return val;
  
}

